<?php
header('Content-Type:text/html;charset=utf-8');
?>
<!DOCTYPE html>
  <head>
    <title>点餐系统</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
    <script src="js/jquery-1.11.3.js"></script>
    <script src="js/bootstrap.js"></script>
  </head>
  <body>
    <?php include 'nav.php' ?>
    <div class="container">
      <div class="row">
        <div class="panel panel-primary">
          <div class="panel-heading">
            <span class="glyphicon glyphicon-th-list">&nbsp订单列表</span>
          </div>

          <table class="table table-bordered">
            <tr>
              <td>餐桌</td>
              <td>生成日期</td>
              <td>结账</td>
            </tr>
            <?php 

              $PDO=new PDO('mysql:dbname=diancan;charset=UTF8;','root');

              $sou=$PDO->prepare('select * from order1,canzhuo where order1.canzhuoid=canzhuo.id');
              $sou->execute();
              $DD=$sou->fetchAll(PDO::FETCH_NAMED);
              foreach ($DD as $DA => $DB) {?>
                <tr>
              <td><?php echo $DB['name']?></td>
              <td><?php echo $DB['DDSCSJ']?></td>
              <td><div class="modal" id="mod<?php echo $DB['ID'][0] ?>">
                <div class="modal-dialog" style="width:500px;">
                  <div class="modal-content">
                    <div class="modal-header" style="background-color:royalblue"> 删除确定<?php echo $DB['name'] ?>
                    </div>
                    <div class="modal-body"> 你确定要删除订单[<?php echo $DB['name']?>]吗？</div>
                    <div class="modal-footer">
                      <a href="/scdd.php?ddid=<?php echo $DB['ID'][0] ?>" class="btn btn-primary">确认</a>
                      <a href="nopay.php" class="btn btn-default">取消</a>
                    </div>
                  </div>
                </div>
              </div>
              <div class="modal" id="modal<?php echo $DB['ID'][0] ?>">
                <div class="modal-dialog">
                  <div class="modal-content">
                    <div class="modal-header">
                      <div class="modal-title">结账确认</div>
                    </div>
                    <div class="modal-body">
                      是否对<?php echo $DB['name']?>结账
                    </div>
                    <div class="modal-footer">
                        <a href="/jz.php?zzid=<?php echo $DB['ID'][1] ?>" class="btn btn-primary">确认</a>
                        <a href="nopay.php" class="btn btn-default">取消</a>
                    </div>
                  </div>
                </div>
              </div>
              
              <a class="btn btn-default" data-toggle="modal" data-target="#modal<?php echo $DB['ID'][0] ?>">结账</a>
              <a class="btn btn-default" data-toggle="modal" data-target="#mod<?php echo $DB['ID'][0] ?>">删除</a></td>
              </tr>
              <?php } ?>
            

          </table>
        </div>
      </div>
    </div>
  </body>
</html>


